//
//  StageScene.swift
//  Loop
//
//  Created by remy on 2021/9/2.
//

import SpriteKit
import GameplayKit

class StageScene: SKScene {
    lazy var stateMachine: GKStateMachine = GKStateMachine(states: [
        ReadyState(scene: self),
        PlayState(scene: self),
        PauseState(scene: self)
    ])
    
    override init(size: CGSize) {
        super.init(size: size)
        physicsWorld.contactDelegate = self
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func didMove(to view: SKView) {
        view.ignoresSiblingOrder = true
        #if DEBUG
        view.showsDrawCount = true
        view.showsNodeCount = true
        view.showsFPS = true
        #endif
        stateMachine.enter(ReadyState.self)
//        initScene()
//        resetGame()
    }
    
    override func update(_ currentTime: TimeInterval) {
        stateMachine.update(deltaTime: currentTime)
    }
}
